# 0未开始 1工作中 2完成
createDisk = """CREATE TABLE IF NOT EXISTS disk (
        id text PRIMARY KEY,
        create_time datetime,
        end_time datetime,
        progress tinyint(1)
    );"""
createFile = """CREATE TABLE IF NOT EXISTS file (
            path text PRIMARY KEY,
            name text,
            skip boolean,
            alter_time datetime,
            filesize bigint,
            tar_hash varchar(6),
            id text
            )"""
createTar = "CREATE TABLE IF NOT EXISTS tar (path text PRIMARY KEY, name text,tar_hash varchar(6))"

insertFileAll = "INSERT OR IGNORE INTO file VALUES (?,?,?,?,?,?,?)"
insertTarAll = "INSERT OR IGNORE INTO tar VALUES (?,?,?)"
insertFilePathTarHash = "INSERT INTO file (path,tar_hash) values(?,?)"
insertDiskIdCreateTimeProgress0 = "INSERT OR IGNORE INTO disk (id,create_time,progress) VALUES (?,?,0)"

selectDiskAll = "SELECT * FROM disk"
selectFileAll = "SELECT * FROM file"
selectTarAll = "SELECT * FROM tar"
selectDiskAllById = "SELECT * FROM disk WHERE id = ?"
selectDiskProgressById = "SELECT progress from disk where id = ?"
selectFileByTarHash = "SELECT * FROM file WHERE tar_hash=?"
selectFileTarHashPathByTarHashNoNull = "SELECT tar_hash,path FROM file WHERE tar_hash is not null"
selectFileAllByTarHashIsNull = "SELECT * FROM file WHERE tar_hash is null"

updateFileTarHashByPath = "UPDATE file SET tar_hash = ? WHERE path = ?"
updateDiskProgressById = "UPDATE disk SET progress = ? WHERE id = ?"
updateDiskEndTimeById = "UPDATE disk SET end_time = ? WHERE id = ?"